package com.oocl.crm_system;

import parseAndHandleTool.HandleCmd;
import parseAndHandleTool.ParseCmd;

public class Environment {
	private DoublyList<Customer> list;

	public DoublyList<Customer> getList() {
		return list;
	}
	public  void setList(DoublyList<Customer> list) {
		this.list = list;
	}
	public void init(){
		list = new DoublyList<Customer>();               //it should be initialized.
		Customer[] persons = Constant.getPersons();
		int i = 9;
		for(i = 0; i < 10; i++){
			list.insertTail(persons[i]);
		}
		System.out.println(Constant.getHelpString());
	}
	public static void main(String[] args) {
		Environment evn = new Environment();
		evn.init();
		
		//ParseCmd pcd = new ParseCmd();
		HandleCmd handler = new HandleCmd();
		DoublyList<Customer> listSon = evn.getList();
		
		InputTool inputTool = new InputTool();
		
		boolean status = true;
		while(status){
			String inputByConsole = inputTool.getInput();
			handler.handle(listSon, inputByConsole);
			//pcd.parseCmd(listSon,inputByConsole);
			if(inputByConsole.equals("Q")){
				status = false;
			}
		}
	}
}